home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1 Issue 2
/
PDCD-1 - Issue 02.iso
/
_utilities
/
utilities
/
004
/
gstobject
/
fasttimer
/
Example
/
CLib
(
.txt
)
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-09-23
|
9KB
|
553 lines
-- BASIC Assembler to initialise with the Shared C Library
-- This program may freely be modified (or not) for use in your
-- own programs.
-- By George Taylor, george@tardis.ed.ac.uk
_Assemble_CLib
[ OPT pass%
; Call
.CLib_start%
.CLib_enter
*; initialise with the Shared C Library
8; call 'main' (complete with command line arguments)
SWI "OS_GetEnv"
MOV r2,r1
ADR r0,CLib_stubs%
$ LDR r1,CLib_workspace_ptr%
MVN r3,#0
MOV r4,#0
MVN r5,#0
MOV r6,#&40000
, SWI "SharedCLibrary_LibInitAPCS_R"
MOV r4,r0
( ADR r0,CLib_kernel_init_block%
MOV r3,#0
B _kernel_init
.CLib_workspace_ptr%
EQUD CLib_workspace%
.CLib_c_init
MOV r0,#1
&) STRB r0,CLib_kernel_statics%+277
MOV r0,sp
STMDB sp !,{lr}
) ADR r1,CLib_rts_block%
LDMIB r1,{r1,r2}
BL _clib_initialise
ADR r0,CLib_c_run
LDMIA sp !,{pc}^
.CLib_c_run
STMFD sp !,{lr}
1$ BL _kernel_command_string
LDMFD sp !,{lr}
LDR r1,CLib_main%
B _main
.CLib_main%
EQUD main
.CLib_stubs%
EQUD 1
;" EQUD CLib_kernel_vectors%
<& EQUD CLib_kernel_vectors_end%
=" EQUD CLib_kernel_statics%
>& EQUD CLib_kernel_statics_end%
EQUD 2
@ EQUD CLib_clib_vectors%
A$ EQUD CLib_clib_vectors_end%
B EQUD CLib_clib_statics%
C$ EQUD CLib_clib_statics_end%
EQUD -1
.CLib_kernel_init_block%
EQUD imagestart%
EQUD CLib_rts_block%
I! EQUD CLib_rts_block_end%
.CLib_rts_block%
L3 EQUD CLib_rts_block_end% - CLib_rts_block%
EQUD imagestart%
EQUD CLib_start%
EQUD CLib_c_str
EQUD CLib_c_init
EQUD 0
EQUD TrapHandler
S! EQUD UncaughtTrapHandler
EQUD EventHandler
U# EQUD UnhandledEventHandler
.CLib_rts_block_end%
.CLib_c_str
EQUS "C"
EQUB 0
ALIGN
.CLib_kernel_statics%
I%=0
&31C
O%!I%=0
P%+=&31C
O%+=&31C
[ OPT pass%
.CLib_kernel_statics_end%
.CLib_clib_statics%
I%=0
&B48
O%!I%=0
P%+=&B48
O%+=&B48
[ OPT pass%
.CLib_clib_statics_end%
.CLib_kernel_vectors%
._kernel_init
MOVS pc,R14
._kernel_exit
MOVS pc,R14
._kernel_setreturncode
MOVS pc,R14
._kernel_exittraphandler
MOVS pc,R14
._kernel_unwind
MOVS pc,R14
._kernel_procname
MOVS pc,R14
._kernel_language
MOVS pc,R14
._kernel_command_string
MOVS pc,R14
._kernel_hostos
MOVS pc,R14
._kernel_swi
MOVS pc,R14
._kernel_osbyte
MOVS pc,R14
._kernel_osrdch
MOVS pc,R14
._kernel_oswrch
MOVS pc,R14
._kernel_osbget
MOVS pc,R14
._kernel_osbput
MOVS pc,R14
._kernel_osgbpb
MOVS pc,R14
._kernel_osword
MOVS pc,R14
._kernel_osfind
MOVS pc,R14
._kernel_osfile
MOVS pc,R14
._kernel_osargs
MOVS pc,R14
._kernel_oscli
MOVS pc,R14
._kernel_last_oserror
MOVS pc,R14
._kernel_system
MOVS pc,R14
._kernel_getenv
MOVS pc,R14
._kernel_setenv
MOVS pc,R14
._kernel_register_allocs
MOVS pc,R14
._kernel_alloc
MOVS pc,R14
._kernel_stkovf_split_0frame
MOVS pc,R14
._kernel_stkovf_split
MOVS pc,R14
._kernel_stkovf_copyargs
MOVS pc,R14
._kernel_stkovf_copy0args
MOVS pc,R14
._kernel_udiv
MOVS pc,R14
._kernel_urem
MOVS pc,R14
._kernel_udiv10
MOVS pc,R14
._kernel_sdiv
MOVS pc,R14
._kernel_srem
MOVS pc,R14
._kernel_sdiv10
MOVS pc,R14
._kernel_fpavailable
MOVS pc,R14
._kernel_moduleinit
MOVS pc,R14
._kernel_irqs_on
MOVS pc,R14
._kernel_irqs_off
MOVS pc,R14
._kernel_irqs_disabled
MOVS pc,R14
._kernel_entermodule
MOVS pc,R14
._kernel_escape_seen
MOVS pc,R14
._kernel_current_stack_chunk
MOVS pc,R14
._kernel_swi_c
MOVS pc,R14
._kernel_register_slotextend
MOVS pc,R14
._kernel_raise_error
MOVS pc,R14
.CLib_kernel_vectors_end%
.CLib_clib_vectors%
.TrapHandler
MOVS pc,R14
.UncaughtTrapHandler
MOVS pc,R14
.EventHandler
MOVS pc,R14
.UnhandledEventHandler
MOVS pc,R14
.x_stack_overflow
MOVS pc,R14
.x_stack_overflow_1
MOVS pc,R14
.x_udivide
MOVS pc,R14
.x_uremainder
MOVS pc,R14
.x_divide
MOVS pc,R14
.x_divtest
MOVS pc,R14
.x_remainder
MOVS pc,R14
.x_multiply
MOVS pc,R14
._rd1chk
MOVS pc,R14
._rd2chk
MOVS pc,R14
._rd4chk
MOVS pc,R14
._wr1chk
MOVS pc,R14
._wr2chk
MOVS pc,R14
._wr4chk
MOVS pc,R14
._main
MOVS pc,R14
._exit
MOVS pc,R14
._clib_initialise
MOVS pc,R14
._backtrace
MOVS pc,R14
._count
MOVS pc,R14
._count1
MOVS pc,R14
._stfp
MOVS pc,R14
._ldfp
MOVS pc,R14
._printf
MOVS pc,R14
._fprintf
MOVS pc,R14
._sprintf
MOVS pc,R14
.clock
MOVS pc,R14
.difftime
MOVS pc,R14
.mktime
MOVS pc,R14
.time
MOVS pc,R14
.asctime
MOVS pc,R14
.ctime
MOVS pc,R14
.gmtime
MOVS pc,R14
.localtime
MOVS pc,R14
.strftime
MOVS pc,R14
.memcpy
MOVS pc,R14
.memmove
MOVS pc,R14
.strcpy
MOVS pc,R14
.strncpy
MOVS pc,R14
.strcat
MOVS pc,R14
.strncat
MOVS pc,R14
.memcmp
MOVS pc,R14
.strcmp
MOVS pc,R14
.strncmp
MOVS pc,R14
.memchr
MOVS pc,R14
.strchr
MOVS pc,R14
.strcspn
MOVS pc,R14
.strpbrk
MOVS pc,R14
.strrchr
MOVS pc,R14
.strspn
MOVS pc,R14
.strstr
MOVS pc,R14
.strtok
MOVS pc,R14
.memset
MOVS pc,R14
.strerror
MOVS pc,R14
.strlen
MOVS pc,R14
I .atof
MOVS pc,R14
K .atoi
MOVS pc,R14
M .atol
MOVS pc,R14
.strtod
MOVS pc,R14
.strtol
MOVS pc,R14
.strtoul
MOVS pc,R14
U .rand
MOVS pc,R14
.srand
MOVS pc,R14
.calloc
MOVS pc,R14
[ .free
MOVS pc,R14
.malloc
MOVS pc,R14
.realloc
MOVS pc,R14
.abort
MOVS pc,R14
.atexit
MOVS pc,R14
e .exit
MOVS pc,R14
.getenv
MOVS pc,R14
.system
MOVS pc,R14
.bsearch
MOVS pc,R14
.qsort
MOVS pc,R14
MOVS pc,R14
MOVS pc,R14
s .labs
MOVS pc,R14
u .ldiv
MOVS pc,R14
.remove
MOVS pc,R14
.rename
MOVS pc,R14
.tmpfile
MOVS pc,R14
.__old_tmpnam
MOVS pc,R14
.fclose
MOVS pc,R14
.fflush
MOVS pc,R14
.fopen
MOVS pc,R14
.freopen
MOVS pc,R14
.setbuf
MOVS pc,R14
.setvbuf
MOVS pc,R14
.printf
MOVS pc,R14
.fprintf
MOVS pc,R14
.sprintf
MOVS pc,R14
.scanf
MOVS pc,R14
.fscanf
MOVS pc,R14
.sscanf
MOVS pc,R14
.vprintf
MOVS pc,R14
.vfprintf
MOVS pc,R14
.vsprintf
MOVS pc,R14
._vfprintf
MOVS pc,R14
.fgetc
MOVS pc,R14
.fgets
MOVS pc,R14
.fputc
MOVS pc,R14
.fputs
MOVS pc,R14
.__filbuf
MOVS pc,R14
.getc
MOVS pc,R14
.getchar
MOVS pc,R14
.gets
MOVS pc,R14
.__flsbuf
MOVS pc,R14
.putc
MOVS pc,R14
.putchar
MOVS pc,R14
.puts
MOVS pc,R14
.ungetc
MOVS pc,R14
.fread
MOVS pc,R14
.fwrite
MOVS pc,R14
.fgetpos
MOVS pc,R14
.fseek
MOVS pc,R14
.fsetpos
MOVS pc,R14
.ftell
MOVS pc,R14
.rewind
MOVS pc,R14
.clearerr
MOVS pc,R14
.feof
MOVS pc,R14
.ferror
MOVS pc,R14
.perror
MOVS pc,R14
.__ignore_signal_handler
MOVS pc,R14
.__default_signal_handler
MOVS pc,R14
.__error_signal_marker
MOVS pc,R14
.signal
MOVS pc,R14
.raise
MOVS pc,R14
.setjmp
MOVS pc,R14
.longjmp
MOVS pc,R14
.acos
MOVS pc,R14
.asin
MOVS pc,R14
.atan
MOVS pc,R14
.atan2
MOVS pc,R14
MOVS pc,R14
MOVS pc,R14
MOVS pc,R14
.cosh
MOVS pc,R14
.sinh
MOVS pc,R14
.tanh
MOVS pc,R14
MOVS pc,R14
.frexp
MOVS pc,R14
.ldexp
MOVS pc,R14
MOVS pc,R14
.log10
MOVS pc,R14
.modf
MOVS pc,R14
MOVS pc,R14
.sqrt
MOVS pc,R14
.ceil
MOVS pc,R14
.fabs
MOVS pc,R14
.floor
MOVS pc,R14
.fmod
MOVS pc,R14
.setlocale
MOVS pc,R14
.isalnum
MOVS pc,R14
.isalpha
MOVS pc,R14
.iscntrl
MOVS pc,R14
.isdigit
MOVS pc,R14
.isgraph
MOVS pc,R14
.islower
MOVS pc,R14
.isprint
MOVS pc,R14
.ispunct
MOVS pc,R14
.isspace
MOVS pc,R14
.isupper
MOVS pc,R14
.isxdigit
MOVS pc,R14
.tolower
MOVS pc,R14
.toupper
MOVS pc,R14
.__assert
MOVS pc,R14
._memcpy
MOVS pc,R14
._memset
MOVS pc,R14
.localeconv
MOVS pc,R14
.mblen
MOVS pc,R14
.mbtowc
MOVS pc,R14
.wctomb
MOVS pc,R14
.mbstowcs
MOVS pc,R14
.wcstombs
MOVS pc,R14
.strxfrm
MOVS pc,R14
.strcoll
MOVS pc,R14
._clib_finalisemodule
MOVS pc,R14
._clib_version
MOVS pc,R14
.Finalise
MOVS pc,R14
.tmpnam
MOVS pc,R14
.CLib_clib_vectors_end%
E7; C workspace goes from here to top of memory space
.CLib_workspace%